define(function(require) {
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");

	var Model = function() {
		this.callParent();
	};

	Model.prototype.backBtn = function(event) {
		this.comp("windowReceiver1").windowEnsure();
		this.getParentModel().goBackCommunity();
	};

	Model.prototype.open = function(event) {
		var row = event.bindingContext.$object;
		
		var option = {
				type:"trends",
				title:row.val("title"),
				content:row.val("content")
		};
		
		justep.Shell.showPage("$UI/communityOto/community/channel/template.w",option);
		
	};

	Model.prototype.workTrendsDataCustomRefresh = function(event){
	    var id = JSON.parse(localStorage.getItem("userInfo")).data[2].id;
		var url = "http://www.xjzlhy.com:81/ex_community/a/api/community/getNewsByCategoryId?callback=?&category.id=55555";		
		$.getJSON(
				url,
				{
				  "office.id":id
				},
				function(data){
				    console.log("trends",data);
				    event.source.loadData(data.data);
				    console.log("trendsData",event.source.getFirstRow());
				}
		);

	};
	
	
	
	Model.prototype.onTouchStart = function(event){
	
	     $(event.currentTarget).addClass("touch");

	};
	
	
	
	Model.prototype.onTouchEnd = function(event){
		$(event.currentTarget).removeClass("touch");
	};

	return Model;
});